
_semtest：     文件格式 elf32-i386


Disassembly of section .text:

00000000 <main>:

//20250514

int
main(int argc, char *argv[])
{
   0:	8d 4c 24 04          	lea    0x4(%esp),%ecx
   4:	83 e4 f0             	and    $0xfffffff0,%esp
   7:	ff 71 fc             	push   -0x4(%ecx)
   a:	55                   	push   %ebp
   b:	89 e5                	mov    %esp,%ebp
   d:	57                   	push   %edi
   e:	56                   	push   %esi
   f:	53                   	push   %ebx
  10:	51                   	push   %ecx
  11:	83 ec 30             	sub    $0x30,%esp

//illegal input
   printf(1,"illegal input test: ");
  14:	68 c0 0b 00 00       	push   $0xbc0
  19:	6a 01                	push   $0x1
  1b:	e8 20 08 00 00       	call   840 <printf>
  int flag=0,i;
  if(alloc_sem(-1)>0||wait_sem(100)>0||signal_sem(100)>0||wait_sem(-1)>0||signal_sem(-1)>0||dealloc_sem(-1)>0){//should return -1
  20:	c7 04 24 ff ff ff ff 	movl   $0xffffffff,(%esp)
  27:	e8 37 07 00 00       	call   763 <alloc_sem>
  2c:	83 c4 10             	add    $0x10,%esp
  2f:	85 c0                	test   %eax,%eax
  31:	0f 8e 76 02 00 00    	jle    2ad <main+0x2ad>
    flag=1;
  37:	be 01 00 00 00       	mov    $0x1,%esi
  3c:	31 db                	xor    %ebx,%ebx
  3e:	eb 0d                	jmp    4d <main+0x4d>
  }
  for(i=0;i<100;i++){
  40:	83 c3 01             	add    $0x1,%ebx
    if(wait_sem(i)>0||signal_sem(i)>0||dealloc_sem(i)>0)
      flag=1;
  43:	be 01 00 00 00       	mov    $0x1,%esi
  for(i=0;i<100;i++){
  48:	83 fb 64             	cmp    $0x64,%ebx
  4b:	74 38                	je     85 <main+0x85>
    if(wait_sem(i)>0||signal_sem(i)>0||dealloc_sem(i)>0)
  4d:	83 ec 0c             	sub    $0xc,%esp
  50:	53                   	push   %ebx
  51:	e8 15 07 00 00       	call   76b <wait_sem>
  56:	83 c4 10             	add    $0x10,%esp
  59:	85 c0                	test   %eax,%eax
  5b:	7f e3                	jg     40 <main+0x40>
  5d:	83 ec 0c             	sub    $0xc,%esp
  60:	53                   	push   %ebx
  61:	e8 0d 07 00 00       	call   773 <signal_sem>
  66:	83 c4 10             	add    $0x10,%esp
  69:	85 c0                	test   %eax,%eax
  6b:	7f d3                	jg     40 <main+0x40>
  6d:	83 ec 0c             	sub    $0xc,%esp
  70:	53                   	push   %ebx
  71:	e8 05 07 00 00       	call   77b <dealloc_sem>
  76:	83 c4 10             	add    $0x10,%esp
  79:	85 c0                	test   %eax,%eax
  7b:	7f c3                	jg     40 <main+0x40>
  for(i=0;i<100;i++){
  7d:	83 c3 01             	add    $0x1,%ebx
  80:	83 fb 64             	cmp    $0x64,%ebx
  83:	75 c8                	jne    4d <main+0x4d>
  }
 
  if(flag==1){
  85:	83 fe 01             	cmp    $0x1,%esi
  88:	0f 84 09 02 00 00    	je     297 <main+0x297>
    printf(1,"fail!\n");
  }else{
    printf(1,"success!\n");
  8e:	57                   	push   %edi
  8f:	57                   	push   %edi
  90:	68 dc 0b 00 00       	push   $0xbdc
  95:	6a 01                	push   $0x1
  97:	e8 a4 07 00 00       	call   840 <printf>
  9c:	83 c4 10             	add    $0x10,%esp
  }

  flag=0;
  //robust
  printf(1,"alloc-dealloc test: ");
  9f:	83 ec 08             	sub    $0x8,%esp
  a2:	be 64 00 00 00       	mov    $0x64,%esi
  flag=0;
  a7:	31 db                	xor    %ebx,%ebx
  for(i=0;i<100;i++){
    if(alloc_sem(100)<0)
      flag=1;
  a9:	bf 01 00 00 00       	mov    $0x1,%edi
  printf(1,"alloc-dealloc test: ");
  ae:	68 e6 0b 00 00       	push   $0xbe6
  b3:	6a 01                	push   $0x1
  b5:	e8 86 07 00 00       	call   840 <printf>
  ba:	83 c4 10             	add    $0x10,%esp
  bd:	8d 76 00             	lea    0x0(%esi),%esi
    if(alloc_sem(100)<0)
  c0:	83 ec 0c             	sub    $0xc,%esp
  c3:	6a 64                	push   $0x64
  c5:	e8 99 06 00 00       	call   763 <alloc_sem>
  ca:	83 c4 10             	add    $0x10,%esp
      flag=1;
  cd:	85 c0                	test   %eax,%eax
  cf:	0f 48 df             	cmovs  %edi,%ebx
  for(i=0;i<100;i++){
  d2:	83 ee 01             	sub    $0x1,%esi
  d5:	75 e9                	jne    c0 <main+0xc0>
  }
  for(i=0;i<100;i++){
  d7:	31 f6                	xor    %esi,%esi
    if(dealloc_sem(i)<0)
      flag=1;
  d9:	bf 01 00 00 00       	mov    $0x1,%edi
  de:	66 90                	xchg   %ax,%ax
    if(dealloc_sem(i)<0)
  e0:	83 ec 0c             	sub    $0xc,%esp
  e3:	56                   	push   %esi
  e4:	e8 92 06 00 00       	call   77b <dealloc_sem>
  e9:	83 c4 10             	add    $0x10,%esp
      flag=1;
  ec:	85 c0                	test   %eax,%eax
  ee:	0f 48 df             	cmovs  %edi,%ebx
  for(i=0;i<100;i++){
  f1:	83 c6 01             	add    $0x1,%esi
  f4:	83 fe 64             	cmp    $0x64,%esi
  f7:	75 e7                	jne    e0 <main+0xe0>
  }
  if((i=alloc_sem(100))<0||dealloc_sem(i)<0)
  f9:	83 ec 0c             	sub    $0xc,%esp
  fc:	6a 64                	push   $0x64
  fe:	e8 60 06 00 00       	call   763 <alloc_sem>
 103:	83 c4 10             	add    $0x10,%esp
 106:	85 c0                	test   %eax,%eax
 108:	78 19                	js     123 <main+0x123>
 10a:	83 ec 0c             	sub    $0xc,%esp
 10d:	50                   	push   %eax
 10e:	e8 68 06 00 00       	call   77b <dealloc_sem>
    flag=1;
  if(flag==1){
 113:	83 c4 10             	add    $0x10,%esp
 116:	85 c0                	test   %eax,%eax
 118:	78 09                	js     123 <main+0x123>
 11a:	80 e3 01             	and    $0x1,%bl
 11d:	0f 84 fa 01 00 00    	je     31d <main+0x31d>
    printf(1,"fail!\n");
 123:	83 ec 08             	sub    $0x8,%esp
 126:	68 d5 0b 00 00       	push   $0xbd5
 12b:	6a 01                	push   $0x1
 12d:	e8 0e 07 00 00       	call   840 <printf>
 132:	83 c4 10             	add    $0x10,%esp
      flag=1;
 135:	31 db                	xor    %ebx,%ebx
  }

   //create 3 semaphores with different initial values
   int s[3],j;
   for(i=0;i<3;i++){
     if((s[i]=alloc_sem(i+1))<0){
 137:	83 ec 0c             	sub    $0xc,%esp
 13a:	83 c3 01             	add    $0x1,%ebx
 13d:	53                   	push   %ebx
 13e:	e8 20 06 00 00       	call   763 <alloc_sem>
 143:	83 c4 10             	add    $0x10,%esp
 146:	89 44 9d d8          	mov    %eax,-0x28(%ebp,%ebx,4)
 14a:	85 c0                	test   %eax,%eax
 14c:	0f 88 e1 01 00 00    	js     333 <main+0x333>
   for(i=0;i<3;i++){
 152:	83 fb 03             	cmp    $0x3,%ebx
 155:	75 e0                	jne    137 <main+0x137>
       printf(1,"error creating semaphore, please debug\n");
       return -1;
     }
   } 
   printf(1,"created semaphores with indices %d %d %d \n",s[0],s[1],s[2]);
 157:	8b 55 e4             	mov    -0x1c(%ebp),%edx
 15a:	8b 4d e0             	mov    -0x20(%ebp),%ecx
 15d:	83 ec 0c             	sub    $0xc,%esp


  for(i=0;i<3;i++){//test the semaphores one by one
 160:	31 f6                	xor    %esi,%esi
   printf(1,"created semaphores with indices %d %d %d \n",s[0],s[1],s[2]);
 162:	8b 7d dc             	mov    -0x24(%ebp),%edi
 165:	52                   	push   %edx
 166:	51                   	push   %ecx
 167:	57                   	push   %edi
 168:	68 70 0c 00 00       	push   $0xc70
 16d:	6a 01                	push   $0x1
 16f:	89 55 cc             	mov    %edx,-0x34(%ebp)
 172:	89 4d d0             	mov    %ecx,-0x30(%ebp)
 175:	89 7d d4             	mov    %edi,-0x2c(%ebp)
 178:	e8 c3 06 00 00       	call   840 <printf>
 17d:	83 c4 20             	add    $0x20,%esp
     printf(1,"testing semaphore %d with initial value %d\n",s[i],i+1);
 180:	83 c6 01             	add    $0x1,%esi
 183:	bb 05 00 00 00       	mov    $0x5,%ebx
 188:	56                   	push   %esi
 189:	57                   	push   %edi
 18a:	68 9c 0c 00 00       	push   $0xc9c
 18f:	6a 01                	push   $0x1
 191:	e8 aa 06 00 00       	call   840 <printf>
 196:	83 c4 10             	add    $0x10,%esp
     for(j=0;j<5;j++){//create 5 children
       if(fork()==0){//child
 199:	e8 fd 04 00 00       	call   69b <fork>
 19e:	85 c0                	test   %eax,%eax
 1a0:	0f 84 aa 01 00 00    	je     350 <main+0x350>
     for(j=0;j<5;j++){//create 5 children
 1a6:	83 eb 01             	sub    $0x1,%ebx
 1a9:	75 ee                	jne    199 <main+0x199>
         compute(s[i]);
         exit();
       }
     }
    for(j=0;j<5;j++) wait();//wait for five children to die
 1ab:	e8 fb 04 00 00       	call   6ab <wait>
 1b0:	e8 f6 04 00 00       	call   6ab <wait>
 1b5:	e8 f1 04 00 00       	call   6ab <wait>
 1ba:	e8 ec 04 00 00       	call   6ab <wait>
 1bf:	e8 e7 04 00 00       	call   6ab <wait>
  for(i=0;i<3;i++){//test the semaphores one by one
 1c4:	83 fe 03             	cmp    $0x3,%esi
 1c7:	74 06                	je     1cf <main+0x1cf>
     printf(1,"testing semaphore %d with initial value %d\n",s[i],i+1);
 1c9:	8b 7c b5 dc          	mov    -0x24(%ebp,%esi,4),%edi
 1cd:	eb b1                	jmp    180 <main+0x180>
  }
   
  printf(1,"normal test done\n");
 1cf:	83 ec 08             	sub    $0x8,%esp
 1d2:	68 fb 0b 00 00       	push   $0xbfb
 1d7:	6a 01                	push   $0x1
 1d9:	e8 62 06 00 00       	call   840 <printf>
  printf(1,"testing dealloc_sem\n");
 1de:	59                   	pop    %ecx
 1df:	5b                   	pop    %ebx
 1e0:	68 0d 0c 00 00       	push   $0xc0d
 1e5:	6a 01                	push   $0x1
 1e7:	e8 54 06 00 00       	call   840 <printf>
  if(fork()==0){    
 1ec:	e8 aa 04 00 00       	call   69b <fork>
 1f1:	83 c4 10             	add    $0x10,%esp
 1f4:	85 c0                	test   %eax,%eax
 1f6:	0f 84 62 01 00 00    	je     35e <main+0x35e>
     printf(1,"pid=%d wait on sem %d: success\n",getpid(),s[0]);//only one child can get here
     wait_sem(s[0]);//it should be blocked here
     printf(1,"should not get here\n");     
     exit();
  }
  if(fork()==0){  //second child,   
 1fc:	e8 9a 04 00 00       	call   69b <fork>
 201:	85 c0                	test   %eax,%eax
 203:	75 50                	jne    255 <main+0x255>
     printf(1,"pid=%d is going to wait on sem %d\n",getpid(),s[1]);
 205:	e8 19 05 00 00       	call   723 <getpid>
 20a:	8b 75 d0             	mov    -0x30(%ebp),%esi
 20d:	56                   	push   %esi
 20e:	50                   	push   %eax
 20f:	68 c8 0c 00 00       	push   $0xcc8
 214:	6a 01                	push   $0x1
 216:	e8 25 06 00 00       	call   840 <printf>
     wait_sem(s[0]);
 21b:	8b 7d d4             	mov    -0x2c(%ebp),%edi
 21e:	89 3c 24             	mov    %edi,(%esp)
 221:	e8 45 05 00 00       	call   76b <wait_sem>
     printf(1,"pid=%d wait on sem %d: success\n",getpid(),s[1]);//only one child can get here
 226:	e8 f8 04 00 00       	call   723 <getpid>
 22b:	56                   	push   %esi
 22c:	50                   	push   %eax
 22d:	68 ec 0c 00 00       	push   $0xcec
 232:	6a 01                	push   $0x1
 234:	e8 07 06 00 00       	call   840 <printf>
     wait_sem(s[0]);//it should be blocked here
 239:	83 c4 14             	add    $0x14,%esp
 23c:	57                   	push   %edi
 23d:	e8 29 05 00 00       	call   76b <wait_sem>
     printf(1,"should not get here\n");     
 242:	58                   	pop    %eax
 243:	5a                   	pop    %edx
 244:	68 22 0c 00 00       	push   $0xc22
 249:	6a 01                	push   $0x1
 24b:	e8 f0 05 00 00       	call   840 <printf>
     exit();
 250:	e8 4e 04 00 00       	call   6a3 <exit>
  }
  sleep(100);
 255:	83 ec 0c             	sub    $0xc,%esp
 258:	6a 64                	push   $0x64
 25a:	e8 d4 04 00 00       	call   733 <sleep>
  dealloc_sem(s[0]);
 25f:	5a                   	pop    %edx
 260:	ff 75 d4             	push   -0x2c(%ebp)
 263:	e8 13 05 00 00       	call   77b <dealloc_sem>
  dealloc_sem(s[1]);
 268:	59                   	pop    %ecx
 269:	ff 75 d0             	push   -0x30(%ebp)
 26c:	e8 0a 05 00 00       	call   77b <dealloc_sem>
  dealloc_sem(s[2]);
 271:	5b                   	pop    %ebx
 272:	ff 75 cc             	push   -0x34(%ebp)
 275:	e8 01 05 00 00       	call   77b <dealloc_sem>
  wait();
 27a:	e8 2c 04 00 00       	call   6ab <wait>
  wait();
 27f:	e8 27 04 00 00       	call   6ab <wait>
  printf(1,"parent leaving \n");
 284:	5e                   	pop    %esi
 285:	5f                   	pop    %edi
 286:	68 37 0c 00 00       	push   $0xc37
 28b:	6a 01                	push   $0x1
 28d:	e8 ae 05 00 00       	call   840 <printf>
  exit(); 
 292:	e8 0c 04 00 00       	call   6a3 <exit>
    printf(1,"fail!\n");
 297:	50                   	push   %eax
 298:	50                   	push   %eax
 299:	68 d5 0b 00 00       	push   $0xbd5
 29e:	6a 01                	push   $0x1
 2a0:	e8 9b 05 00 00       	call   840 <printf>
 2a5:	83 c4 10             	add    $0x10,%esp
 2a8:	e9 f2 fd ff ff       	jmp    9f <main+0x9f>
  if(alloc_sem(-1)>0||wait_sem(100)>0||signal_sem(100)>0||wait_sem(-1)>0||signal_sem(-1)>0||dealloc_sem(-1)>0){//should return -1
 2ad:	83 ec 0c             	sub    $0xc,%esp
 2b0:	6a 64                	push   $0x64
 2b2:	e8 b4 04 00 00       	call   76b <wait_sem>
 2b7:	83 c4 10             	add    $0x10,%esp
 2ba:	85 c0                	test   %eax,%eax
 2bc:	0f 8f 75 fd ff ff    	jg     37 <main+0x37>
 2c2:	83 ec 0c             	sub    $0xc,%esp
 2c5:	6a 64                	push   $0x64
 2c7:	e8 a7 04 00 00       	call   773 <signal_sem>
 2cc:	83 c4 10             	add    $0x10,%esp
 2cf:	85 c0                	test   %eax,%eax
 2d1:	0f 8f 60 fd ff ff    	jg     37 <main+0x37>
 2d7:	83 ec 0c             	sub    $0xc,%esp
 2da:	6a ff                	push   $0xffffffff
 2dc:	e8 8a 04 00 00       	call   76b <wait_sem>
 2e1:	83 c4 10             	add    $0x10,%esp
 2e4:	85 c0                	test   %eax,%eax
 2e6:	0f 8f 4b fd ff ff    	jg     37 <main+0x37>
 2ec:	83 ec 0c             	sub    $0xc,%esp
 2ef:	6a ff                	push   $0xffffffff
 2f1:	e8 7d 04 00 00       	call   773 <signal_sem>
 2f6:	83 c4 10             	add    $0x10,%esp
 2f9:	85 c0                	test   %eax,%eax
 2fb:	0f 8f 36 fd ff ff    	jg     37 <main+0x37>
 301:	83 ec 0c             	sub    $0xc,%esp
 304:	6a ff                	push   $0xffffffff
 306:	e8 70 04 00 00       	call   77b <dealloc_sem>
 30b:	83 c4 10             	add    $0x10,%esp
 30e:	85 c0                	test   %eax,%eax
 310:	0f 9f c0             	setg   %al
 313:	0f b6 c0             	movzbl %al,%eax
 316:	89 c6                	mov    %eax,%esi
 318:	e9 1f fd ff ff       	jmp    3c <main+0x3c>
    printf(1,"success!\n");
 31d:	56                   	push   %esi
 31e:	56                   	push   %esi
 31f:	68 dc 0b 00 00       	push   $0xbdc
 324:	6a 01                	push   $0x1
 326:	e8 15 05 00 00       	call   840 <printf>
 32b:	83 c4 10             	add    $0x10,%esp
 32e:	e9 02 fe ff ff       	jmp    135 <main+0x135>
       printf(1,"error creating semaphore, please debug\n");
 333:	50                   	push   %eax
 334:	50                   	push   %eax
 335:	68 48 0c 00 00       	push   $0xc48
 33a:	6a 01                	push   $0x1
 33c:	e8 ff 04 00 00       	call   840 <printf>
}
 341:	8d 65 f0             	lea    -0x10(%ebp),%esp
 344:	83 c8 ff             	or     $0xffffffff,%eax
 347:	59                   	pop    %ecx
 348:	5b                   	pop    %ebx
 349:	5e                   	pop    %esi
 34a:	5f                   	pop    %edi
 34b:	5d                   	pop    %ebp
 34c:	8d 61 fc             	lea    -0x4(%ecx),%esp
 34f:	c3                   	ret    
         compute(s[i]);
 350:	83 ec 0c             	sub    $0xc,%esp
 353:	57                   	push   %edi
 354:	e8 37 00 00 00       	call   390 <compute>
         exit();
 359:	e8 45 03 00 00       	call   6a3 <exit>
     printf(1,"pid=%d is going to wait on sem %d\n",getpid(),s[0]);
 35e:	e8 c0 03 00 00       	call   723 <getpid>
 363:	8b 7d d4             	mov    -0x2c(%ebp),%edi
 366:	57                   	push   %edi
 367:	50                   	push   %eax
 368:	68 c8 0c 00 00       	push   $0xcc8
 36d:	6a 01                	push   $0x1
 36f:	e8 cc 04 00 00       	call   840 <printf>
     wait_sem(s[0]);
 374:	89 3c 24             	mov    %edi,(%esp)
 377:	e8 ef 03 00 00       	call   76b <wait_sem>
     printf(1,"pid=%d wait on sem %d: success\n",getpid(),s[0]);//only one child can get here
 37c:	e8 a2 03 00 00       	call   723 <getpid>
 381:	57                   	push   %edi
 382:	e9 a5 fe ff ff       	jmp    22c <main+0x22c>
 387:	66 90                	xchg   %ax,%ax
 389:	66 90                	xchg   %ax,%ax
 38b:	66 90                	xchg   %ax,%ax
 38d:	66 90                	xchg   %ax,%ax
 38f:	90                   	nop

00000390 <compute>:
void compute(int sem){//wait on a semaphore, print something, and then signal the semaphore
 390:	55                   	push   %ebp
 391:	89 e5                	mov    %esp,%ebp
 393:	57                   	push   %edi
 394:	56                   	push   %esi
 395:	53                   	push   %ebx
 396:	bb 14 00 00 00       	mov    $0x14,%ebx
 39b:	83 ec 0c             	sub    $0xc,%esp
 39e:	8b 7d 08             	mov    0x8(%ebp),%edi
  int pid=getpid(),i=0;
 3a1:	e8 7d 03 00 00       	call   723 <getpid>
  sleep(3);
 3a6:	83 ec 0c             	sub    $0xc,%esp
 3a9:	6a 03                	push   $0x3
  int pid=getpid(),i=0;
 3ab:	89 c6                	mov    %eax,%esi
  sleep(3);
 3ad:	e8 81 03 00 00       	call   733 <sleep>
  if((wait_sem(sem))<0){
 3b2:	89 3c 24             	mov    %edi,(%esp)
 3b5:	e8 b1 03 00 00       	call   76b <wait_sem>
 3ba:	83 c4 10             	add    $0x10,%esp
 3bd:	85 c0                	test   %eax,%eax
 3bf:	78 50                	js     411 <compute+0x81>
 3c1:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
    printf(1,"-%d-",pid);
 3c8:	83 ec 04             	sub    $0x4,%esp
 3cb:	56                   	push   %esi
 3cc:	68 84 0b 00 00       	push   $0xb84
 3d1:	6a 01                	push   $0x1
 3d3:	e8 68 04 00 00       	call   840 <printf>
    sleep(3);
 3d8:	c7 04 24 03 00 00 00 	movl   $0x3,(%esp)
 3df:	e8 4f 03 00 00       	call   733 <sleep>
  for(i=0;i<20;i++){
 3e4:	83 c4 10             	add    $0x10,%esp
 3e7:	83 eb 01             	sub    $0x1,%ebx
 3ea:	75 dc                	jne    3c8 <compute+0x38>
  printf(1,"\nleaving(pid=%d,sem=%d)\n",pid,sem);
 3ec:	57                   	push   %edi
 3ed:	56                   	push   %esi
 3ee:	68 89 0b 00 00       	push   $0xb89
 3f3:	6a 01                	push   $0x1
 3f5:	e8 46 04 00 00       	call   840 <printf>
  if(signal_sem(sem)<0){
 3fa:	89 3c 24             	mov    %edi,(%esp)
 3fd:	e8 71 03 00 00       	call   773 <signal_sem>
 402:	83 c4 10             	add    $0x10,%esp
 405:	85 c0                	test   %eax,%eax
 407:	78 21                	js     42a <compute+0x9a>
}
 409:	8d 65 f4             	lea    -0xc(%ebp),%esp
 40c:	5b                   	pop    %ebx
 40d:	5e                   	pop    %esi
 40e:	5f                   	pop    %edi
 40f:	5d                   	pop    %ebp
 410:	c3                   	ret    
    printf(1,"wait error, pid=%d, sem=%d\n",pid,sem);
 411:	57                   	push   %edi
 412:	56                   	push   %esi
 413:	68 68 0b 00 00       	push   $0xb68
 418:	6a 01                	push   $0x1
 41a:	e8 21 04 00 00       	call   840 <printf>
    return;
 41f:	83 c4 10             	add    $0x10,%esp
}
 422:	8d 65 f4             	lea    -0xc(%ebp),%esp
 425:	5b                   	pop    %ebx
 426:	5e                   	pop    %esi
 427:	5f                   	pop    %edi
 428:	5d                   	pop    %ebp
 429:	c3                   	ret    
    printf(1,"signal error, pid=%d, sem=%d\n",pid,sem);
 42a:	57                   	push   %edi
 42b:	56                   	push   %esi
 42c:	68 a2 0b 00 00       	push   $0xba2
 431:	6a 01                	push   $0x1
 433:	e8 08 04 00 00       	call   840 <printf>
    return;
 438:	83 c4 10             	add    $0x10,%esp
}
 43b:	8d 65 f4             	lea    -0xc(%ebp),%esp
 43e:	5b                   	pop    %ebx
 43f:	5e                   	pop    %esi
 440:	5f                   	pop    %edi
 441:	5d                   	pop    %ebp
 442:	c3                   	ret    
 443:	66 90                	xchg   %ax,%ax
 445:	66 90                	xchg   %ax,%ax
 447:	66 90                	xchg   %ax,%ax
 449:	66 90                	xchg   %ax,%ax
 44b:	66 90                	xchg   %ax,%ax
 44d:	66 90                	xchg   %ax,%ax
 44f:	90                   	nop

00000450 <strcpy>:
#include "user.h"
#include "x86.h"

char*
strcpy(char *s, char *t)
{
 450:	55                   	push   %ebp
  char *os;

  os = s;
  while((*s++ = *t++) != 0)
 451:	31 c0                	xor    %eax,%eax
{
 453:	89 e5                	mov    %esp,%ebp
 455:	53                   	push   %ebx
 456:	8b 4d 08             	mov    0x8(%ebp),%ecx
 459:	8b 5d 0c             	mov    0xc(%ebp),%ebx
 45c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  while((*s++ = *t++) != 0)
 460:	0f b6 14 03          	movzbl (%ebx,%eax,1),%edx
 464:	88 14 01             	mov    %dl,(%ecx,%eax,1)
 467:	83 c0 01             	add    $0x1,%eax
 46a:	84 d2                	test   %dl,%dl
 46c:	75 f2                	jne    460 <strcpy+0x10>
    ;
  return os;
}
 46e:	8b 5d fc             	mov    -0x4(%ebp),%ebx
 471:	89 c8                	mov    %ecx,%eax
 473:	c9                   	leave  
 474:	c3                   	ret    
 475:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 47c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi

00000480 <strcmp>:

int
strcmp(const char *p, const char *q)
{
 480:	55                   	push   %ebp
 481:	89 e5                	mov    %esp,%ebp
 483:	53                   	push   %ebx
 484:	8b 55 08             	mov    0x8(%ebp),%edx
 487:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  while(*p && *p == *q)
 48a:	0f b6 02             	movzbl (%edx),%eax
 48d:	84 c0                	test   %al,%al
 48f:	75 17                	jne    4a8 <strcmp+0x28>
 491:	eb 3a                	jmp    4cd <strcmp+0x4d>
 493:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
 497:	90                   	nop
 498:	0f b6 42 01          	movzbl 0x1(%edx),%eax
    p++, q++;
 49c:	83 c2 01             	add    $0x1,%edx
 49f:	8d 59 01             	lea    0x1(%ecx),%ebx
  while(*p && *p == *q)
 4a2:	84 c0                	test   %al,%al
 4a4:	74 1a                	je     4c0 <strcmp+0x40>
    p++, q++;
 4a6:	89 d9                	mov    %ebx,%ecx
  while(*p && *p == *q)
 4a8:	0f b6 19             	movzbl (%ecx),%ebx
 4ab:	38 c3                	cmp    %al,%bl
 4ad:	74 e9                	je     498 <strcmp+0x18>
  return (uchar)*p - (uchar)*q;
 4af:	29 d8                	sub    %ebx,%eax
}
 4b1:	8b 5d fc             	mov    -0x4(%ebp),%ebx
 4b4:	c9                   	leave  
 4b5:	c3                   	ret    
 4b6:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 4bd:	8d 76 00             	lea    0x0(%esi),%esi
  return (uchar)*p - (uchar)*q;
 4c0:	0f b6 59 01          	movzbl 0x1(%ecx),%ebx
 4c4:	31 c0                	xor    %eax,%eax
 4c6:	29 d8                	sub    %ebx,%eax
}
 4c8:	8b 5d fc             	mov    -0x4(%ebp),%ebx
 4cb:	c9                   	leave  
 4cc:	c3                   	ret    
  return (uchar)*p - (uchar)*q;
 4cd:	0f b6 19             	movzbl (%ecx),%ebx
 4d0:	31 c0                	xor    %eax,%eax
 4d2:	eb db                	jmp    4af <strcmp+0x2f>
 4d4:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 4db:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
 4df:	90                   	nop

000004e0 <strlen>:

uint
strlen(char *s)
{
 4e0:	55                   	push   %ebp
 4e1:	89 e5                	mov    %esp,%ebp
 4e3:	8b 55 08             	mov    0x8(%ebp),%edx
  int n;

  for(n = 0; s[n]; n++)
 4e6:	80 3a 00             	cmpb   $0x0,(%edx)
 4e9:	74 15                	je     500 <strlen+0x20>
 4eb:	31 c0                	xor    %eax,%eax
 4ed:	8d 76 00             	lea    0x0(%esi),%esi
 4f0:	83 c0 01             	add    $0x1,%eax
 4f3:	80 3c 02 00          	cmpb   $0x0,(%edx,%eax,1)
 4f7:	89 c1                	mov    %eax,%ecx
 4f9:	75 f5                	jne    4f0 <strlen+0x10>
    ;
  return n;
}
 4fb:	89 c8                	mov    %ecx,%eax
 4fd:	5d                   	pop    %ebp
 4fe:	c3                   	ret    
 4ff:	90                   	nop
  for(n = 0; s[n]; n++)
 500:	31 c9                	xor    %ecx,%ecx
}
 502:	5d                   	pop    %ebp
 503:	89 c8                	mov    %ecx,%eax
 505:	c3                   	ret    
 506:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 50d:	8d 76 00             	lea    0x0(%esi),%esi

00000510 <memset>:

void*
memset(void *dst, int c, uint n)
{
 510:	55                   	push   %ebp
 511:	89 e5                	mov    %esp,%ebp
 513:	57                   	push   %edi
 514:	8b 55 08             	mov    0x8(%ebp),%edx
}

static inline void
stosb(void *addr, int data, int cnt)
{
  asm volatile("cld; rep stosb" :
 517:	8b 4d 10             	mov    0x10(%ebp),%ecx
 51a:	8b 45 0c             	mov    0xc(%ebp),%eax
 51d:	89 d7                	mov    %edx,%edi
 51f:	fc                   	cld    
 520:	f3 aa                	rep stos %al,%es:(%edi)
  stosb(dst, c, n);
  return dst;
}
 522:	8b 7d fc             	mov    -0x4(%ebp),%edi
 525:	89 d0                	mov    %edx,%eax
 527:	c9                   	leave  
 528:	c3                   	ret    
 529:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi

00000530 <strchr>:

char*
strchr(const char *s, char c)
{
 530:	55                   	push   %ebp
 531:	89 e5                	mov    %esp,%ebp
 533:	8b 45 08             	mov    0x8(%ebp),%eax
 536:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
  for(; *s; s++)
 53a:	0f b6 10             	movzbl (%eax),%edx
 53d:	84 d2                	test   %dl,%dl
 53f:	75 12                	jne    553 <strchr+0x23>
 541:	eb 1d                	jmp    560 <strchr+0x30>
 543:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
 547:	90                   	nop
 548:	0f b6 50 01          	movzbl 0x1(%eax),%edx
 54c:	83 c0 01             	add    $0x1,%eax
 54f:	84 d2                	test   %dl,%dl
 551:	74 0d                	je     560 <strchr+0x30>
    if(*s == c)
 553:	38 d1                	cmp    %dl,%cl
 555:	75 f1                	jne    548 <strchr+0x18>
      return (char*)s;
  return 0;
}
 557:	5d                   	pop    %ebp
 558:	c3                   	ret    
 559:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  return 0;
 560:	31 c0                	xor    %eax,%eax
}
 562:	5d                   	pop    %ebp
 563:	c3                   	ret    
 564:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 56b:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
 56f:	90                   	nop

00000570 <gets>:

char*
gets(char *buf, int max)
{
 570:	55                   	push   %ebp
 571:	89 e5                	mov    %esp,%ebp
 573:	57                   	push   %edi
 574:	56                   	push   %esi
  int i, cc;
  char c;

  for(i=0; i+1 < max; ){
    cc = read(0, &c, 1);
 575:	8d 7d e7             	lea    -0x19(%ebp),%edi
{
 578:	53                   	push   %ebx
  for(i=0; i+1 < max; ){
 579:	31 db                	xor    %ebx,%ebx
{
 57b:	83 ec 1c             	sub    $0x1c,%esp
  for(i=0; i+1 < max; ){
 57e:	eb 27                	jmp    5a7 <gets+0x37>
    cc = read(0, &c, 1);
 580:	83 ec 04             	sub    $0x4,%esp
 583:	6a 01                	push   $0x1
 585:	57                   	push   %edi
 586:	6a 00                	push   $0x0
 588:	e8 2e 01 00 00       	call   6bb <read>
    if(cc < 1)
 58d:	83 c4 10             	add    $0x10,%esp
 590:	85 c0                	test   %eax,%eax
 592:	7e 1d                	jle    5b1 <gets+0x41>
      break;
    buf[i++] = c;
 594:	0f b6 45 e7          	movzbl -0x19(%ebp),%eax
 598:	8b 55 08             	mov    0x8(%ebp),%edx
 59b:	88 44 1a ff          	mov    %al,-0x1(%edx,%ebx,1)
    if(c == '\n' || c == '\r')
 59f:	3c 0a                	cmp    $0xa,%al
 5a1:	74 1d                	je     5c0 <gets+0x50>
 5a3:	3c 0d                	cmp    $0xd,%al
 5a5:	74 19                	je     5c0 <gets+0x50>
  for(i=0; i+1 < max; ){
 5a7:	89 de                	mov    %ebx,%esi
 5a9:	83 c3 01             	add    $0x1,%ebx
 5ac:	3b 5d 0c             	cmp    0xc(%ebp),%ebx
 5af:	7c cf                	jl     580 <gets+0x10>
      break;
  }
  buf[i] = '\0';
 5b1:	8b 45 08             	mov    0x8(%ebp),%eax
 5b4:	c6 04 30 00          	movb   $0x0,(%eax,%esi,1)
  return buf;
}
 5b8:	8d 65 f4             	lea    -0xc(%ebp),%esp
 5bb:	5b                   	pop    %ebx
 5bc:	5e                   	pop    %esi
 5bd:	5f                   	pop    %edi
 5be:	5d                   	pop    %ebp
 5bf:	c3                   	ret    
  buf[i] = '\0';
 5c0:	8b 45 08             	mov    0x8(%ebp),%eax
 5c3:	89 de                	mov    %ebx,%esi
 5c5:	c6 04 30 00          	movb   $0x0,(%eax,%esi,1)
}
 5c9:	8d 65 f4             	lea    -0xc(%ebp),%esp
 5cc:	5b                   	pop    %ebx
 5cd:	5e                   	pop    %esi
 5ce:	5f                   	pop    %edi
 5cf:	5d                   	pop    %ebp
 5d0:	c3                   	ret    
 5d1:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 5d8:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 5df:	90                   	nop

000005e0 <stat>:

int
stat(char *n, struct stat *st)
{
 5e0:	55                   	push   %ebp
 5e1:	89 e5                	mov    %esp,%ebp
 5e3:	56                   	push   %esi
 5e4:	53                   	push   %ebx
  int fd;
  int r;

  fd = open(n, O_RDONLY);
 5e5:	83 ec 08             	sub    $0x8,%esp
 5e8:	6a 00                	push   $0x0
 5ea:	ff 75 08             	push   0x8(%ebp)
 5ed:	e8 f1 00 00 00       	call   6e3 <open>
  if(fd < 0)
 5f2:	83 c4 10             	add    $0x10,%esp
 5f5:	85 c0                	test   %eax,%eax
 5f7:	78 27                	js     620 <stat+0x40>
    return -1;
  r = fstat(fd, st);
 5f9:	83 ec 08             	sub    $0x8,%esp
 5fc:	ff 75 0c             	push   0xc(%ebp)
 5ff:	89 c3                	mov    %eax,%ebx
 601:	50                   	push   %eax
 602:	e8 f4 00 00 00       	call   6fb <fstat>
  close(fd);
 607:	89 1c 24             	mov    %ebx,(%esp)
  r = fstat(fd, st);
 60a:	89 c6                	mov    %eax,%esi
  close(fd);
 60c:	e8 ba 00 00 00       	call   6cb <close>
  return r;
 611:	83 c4 10             	add    $0x10,%esp
}
 614:	8d 65 f8             	lea    -0x8(%ebp),%esp
 617:	89 f0                	mov    %esi,%eax
 619:	5b                   	pop    %ebx
 61a:	5e                   	pop    %esi
 61b:	5d                   	pop    %ebp
 61c:	c3                   	ret    
 61d:	8d 76 00             	lea    0x0(%esi),%esi
    return -1;
 620:	be ff ff ff ff       	mov    $0xffffffff,%esi
 625:	eb ed                	jmp    614 <stat+0x34>
 627:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 62e:	66 90                	xchg   %ax,%ax

00000630 <atoi>:

int
atoi(const char *s)
{
 630:	55                   	push   %ebp
 631:	89 e5                	mov    %esp,%ebp
 633:	53                   	push   %ebx
 634:	8b 55 08             	mov    0x8(%ebp),%edx
  int n;

  n = 0;
  while('0' <= *s && *s <= '9')
 637:	0f be 02             	movsbl (%edx),%eax
 63a:	8d 48 d0             	lea    -0x30(%eax),%ecx
 63d:	80 f9 09             	cmp    $0x9,%cl
  n = 0;
 640:	b9 00 00 00 00       	mov    $0x0,%ecx
  while('0' <= *s && *s <= '9')
 645:	77 1e                	ja     665 <atoi+0x35>
 647:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 64e:	66 90                	xchg   %ax,%ax
    n = n*10 + *s++ - '0';
 650:	83 c2 01             	add    $0x1,%edx
 653:	8d 0c 89             	lea    (%ecx,%ecx,4),%ecx
 656:	8d 4c 48 d0          	lea    -0x30(%eax,%ecx,2),%ecx
  while('0' <= *s && *s <= '9')
 65a:	0f be 02             	movsbl (%edx),%eax
 65d:	8d 58 d0             	lea    -0x30(%eax),%ebx
 660:	80 fb 09             	cmp    $0x9,%bl
 663:	76 eb                	jbe    650 <atoi+0x20>
  return n;
}
 665:	8b 5d fc             	mov    -0x4(%ebp),%ebx
 668:	89 c8                	mov    %ecx,%eax
 66a:	c9                   	leave  
 66b:	c3                   	ret    
 66c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi

00000670 <memmove>:

void*
memmove(void *vdst, void *vsrc, int n)
{
 670:	55                   	push   %ebp
 671:	89 e5                	mov    %esp,%ebp
 673:	57                   	push   %edi
 674:	8b 45 10             	mov    0x10(%ebp),%eax
 677:	8b 55 08             	mov    0x8(%ebp),%edx
 67a:	56                   	push   %esi
 67b:	8b 75 0c             	mov    0xc(%ebp),%esi
  char *dst, *src;

  dst = vdst;
  src = vsrc;
  while(n-- > 0)
 67e:	85 c0                	test   %eax,%eax
 680:	7e 13                	jle    695 <memmove+0x25>
 682:	01 d0                	add    %edx,%eax
  dst = vdst;
 684:	89 d7                	mov    %edx,%edi
 686:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 68d:	8d 76 00             	lea    0x0(%esi),%esi
    *dst++ = *src++;
 690:	a4                   	movsb  %ds:(%esi),%es:(%edi)
  while(n-- > 0)
 691:	39 f8                	cmp    %edi,%eax
 693:	75 fb                	jne    690 <memmove+0x20>
  return vdst;
}
 695:	5e                   	pop    %esi
 696:	89 d0                	mov    %edx,%eax
 698:	5f                   	pop    %edi
 699:	5d                   	pop    %ebp
 69a:	c3                   	ret    

0000069b <fork>:
  name: \
    movl $SYS_ ## name, %eax; \
    int $T_SYSCALL; \
    ret

SYSCALL(fork)
 69b:	b8 01 00 00 00       	mov    $0x1,%eax
 6a0:	cd 40                	int    $0x40
 6a2:	c3                   	ret    

000006a3 <exit>:
SYSCALL(exit)
 6a3:	b8 02 00 00 00       	mov    $0x2,%eax
 6a8:	cd 40                	int    $0x40
 6aa:	c3                   	ret    

000006ab <wait>:
SYSCALL(wait)
 6ab:	b8 03 00 00 00       	mov    $0x3,%eax
 6b0:	cd 40                	int    $0x40
 6b2:	c3                   	ret    

000006b3 <pipe>:
SYSCALL(pipe)
 6b3:	b8 04 00 00 00       	mov    $0x4,%eax
 6b8:	cd 40                	int    $0x40
 6ba:	c3                   	ret    

000006bb <read>:
SYSCALL(read)
 6bb:	b8 05 00 00 00       	mov    $0x5,%eax
 6c0:	cd 40                	int    $0x40
 6c2:	c3                   	ret    

000006c3 <write>:
SYSCALL(write)
 6c3:	b8 10 00 00 00       	mov    $0x10,%eax
 6c8:	cd 40                	int    $0x40
 6ca:	c3                   	ret    

000006cb <close>:
SYSCALL(close)
 6cb:	b8 15 00 00 00       	mov    $0x15,%eax
 6d0:	cd 40                	int    $0x40
 6d2:	c3                   	ret    

000006d3 <kill>:
SYSCALL(kill)
 6d3:	b8 06 00 00 00       	mov    $0x6,%eax
 6d8:	cd 40                	int    $0x40
 6da:	c3                   	ret    

000006db <exec>:
SYSCALL(exec)
 6db:	b8 07 00 00 00       	mov    $0x7,%eax
 6e0:	cd 40                	int    $0x40
 6e2:	c3                   	ret    

000006e3 <open>:
SYSCALL(open)
 6e3:	b8 0f 00 00 00       	mov    $0xf,%eax
 6e8:	cd 40                	int    $0x40
 6ea:	c3                   	ret    

000006eb <mknod>:
SYSCALL(mknod)
 6eb:	b8 11 00 00 00       	mov    $0x11,%eax
 6f0:	cd 40                	int    $0x40
 6f2:	c3                   	ret    

000006f3 <unlink>:
SYSCALL(unlink)
 6f3:	b8 12 00 00 00       	mov    $0x12,%eax
 6f8:	cd 40                	int    $0x40
 6fa:	c3                   	ret    

000006fb <fstat>:
SYSCALL(fstat)
 6fb:	b8 08 00 00 00       	mov    $0x8,%eax
 700:	cd 40                	int    $0x40
 702:	c3                   	ret    

00000703 <link>:
SYSCALL(link)
 703:	b8 13 00 00 00       	mov    $0x13,%eax
 708:	cd 40                	int    $0x40
 70a:	c3                   	ret    

0000070b <mkdir>:
SYSCALL(mkdir)
 70b:	b8 14 00 00 00       	mov    $0x14,%eax
 710:	cd 40                	int    $0x40
 712:	c3                   	ret    

00000713 <chdir>:
SYSCALL(chdir)
 713:	b8 09 00 00 00       	mov    $0x9,%eax
 718:	cd 40                	int    $0x40
 71a:	c3                   	ret    

0000071b <dup>:
SYSCALL(dup)
 71b:	b8 0a 00 00 00       	mov    $0xa,%eax
 720:	cd 40                	int    $0x40
 722:	c3                   	ret    

00000723 <getpid>:
SYSCALL(getpid)
 723:	b8 0b 00 00 00       	mov    $0xb,%eax
 728:	cd 40                	int    $0x40
 72a:	c3                   	ret    

0000072b <sbrk>:
SYSCALL(sbrk)
 72b:	b8 0c 00 00 00       	mov    $0xc,%eax
 730:	cd 40                	int    $0x40
 732:	c3                   	ret    

00000733 <sleep>:
SYSCALL(sleep)
 733:	b8 0d 00 00 00       	mov    $0xd,%eax
 738:	cd 40                	int    $0x40
 73a:	c3                   	ret    

0000073b <uptime>:
SYSCALL(uptime)
 73b:	b8 0e 00 00 00       	mov    $0xe,%eax
 740:	cd 40                	int    $0x40
 742:	c3                   	ret    

00000743 <shutdown>:
SYSCALL(shutdown)
 743:	b8 16 00 00 00       	mov    $0x16,%eax
 748:	cd 40                	int    $0x40
 74a:	c3                   	ret    

0000074b <set_quantum>:
SYSCALL(set_quantum)
 74b:	b8 19 00 00 00       	mov    $0x19,%eax
 750:	cd 40                	int    $0x40
 752:	c3                   	ret    

00000753 <set_priority>:
SYSCALL(set_priority)
 753:	b8 17 00 00 00       	mov    $0x17,%eax
 758:	cd 40                	int    $0x40
 75a:	c3                   	ret    

0000075b <enable_sched_display>:
SYSCALL(enable_sched_display)
 75b:	b8 18 00 00 00       	mov    $0x18,%eax
 760:	cd 40                	int    $0x40
 762:	c3                   	ret    

00000763 <alloc_sem>:
SYSCALL(alloc_sem)
 763:	b8 1a 00 00 00       	mov    $0x1a,%eax
 768:	cd 40                	int    $0x40
 76a:	c3                   	ret    

0000076b <wait_sem>:
SYSCALL(wait_sem)
 76b:	b8 1b 00 00 00       	mov    $0x1b,%eax
 770:	cd 40                	int    $0x40
 772:	c3                   	ret    

00000773 <signal_sem>:
SYSCALL(signal_sem)
 773:	b8 1c 00 00 00       	mov    $0x1c,%eax
 778:	cd 40                	int    $0x40
 77a:	c3                   	ret    

0000077b <dealloc_sem>:
SYSCALL(dealloc_sem)
 77b:	b8 1d 00 00 00       	mov    $0x1d,%eax
 780:	cd 40                	int    $0x40
 782:	c3                   	ret    
 783:	66 90                	xchg   %ax,%ax
 785:	66 90                	xchg   %ax,%ax
 787:	66 90                	xchg   %ax,%ax
 789:	66 90                	xchg   %ax,%ax
 78b:	66 90                	xchg   %ax,%ax
 78d:	66 90                	xchg   %ax,%ax
 78f:	90                   	nop

00000790 <printint>:
  write(fd, &c, 1);
}

static void
printint(int fd, int xx, int base, int sgn)
{
 790:	55                   	push   %ebp
 791:	89 e5                	mov    %esp,%ebp
 793:	57                   	push   %edi
 794:	56                   	push   %esi
 795:	53                   	push   %ebx
 796:	83 ec 3c             	sub    $0x3c,%esp
 799:	89 4d c4             	mov    %ecx,-0x3c(%ebp)
  uint x;

  neg = 0;
  if(sgn && xx < 0){
    neg = 1;
    x = -xx;
 79c:	89 d1                	mov    %edx,%ecx
{
 79e:	89 45 b8             	mov    %eax,-0x48(%ebp)
  if(sgn && xx < 0){
 7a1:	85 d2                	test   %edx,%edx
 7a3:	0f 89 7f 00 00 00    	jns    828 <printint+0x98>
 7a9:	f6 45 08 01          	testb  $0x1,0x8(%ebp)
 7ad:	74 79                	je     828 <printint+0x98>
    neg = 1;
 7af:	c7 45 bc 01 00 00 00 	movl   $0x1,-0x44(%ebp)
    x = -xx;
 7b6:	f7 d9                	neg    %ecx
  } else {
    x = xx;
  }

  i = 0;
 7b8:	31 db                	xor    %ebx,%ebx
 7ba:	8d 75 d7             	lea    -0x29(%ebp),%esi
 7bd:	8d 76 00             	lea    0x0(%esi),%esi
  do{
    buf[i++] = digits[x % base];
 7c0:	89 c8                	mov    %ecx,%eax
 7c2:	31 d2                	xor    %edx,%edx
 7c4:	89 cf                	mov    %ecx,%edi
 7c6:	f7 75 c4             	divl   -0x3c(%ebp)
 7c9:	0f b6 92 6c 0d 00 00 	movzbl 0xd6c(%edx),%edx
 7d0:	89 45 c0             	mov    %eax,-0x40(%ebp)
 7d3:	89 d8                	mov    %ebx,%eax
 7d5:	8d 5b 01             	lea    0x1(%ebx),%ebx
  }while((x /= base) != 0);
 7d8:	8b 4d c0             	mov    -0x40(%ebp),%ecx
    buf[i++] = digits[x % base];
 7db:	88 14 1e             	mov    %dl,(%esi,%ebx,1)
  }while((x /= base) != 0);
 7de:	39 7d c4             	cmp    %edi,-0x3c(%ebp)
 7e1:	76 dd                	jbe    7c0 <printint+0x30>
  if(neg)
 7e3:	8b 4d bc             	mov    -0x44(%ebp),%ecx
 7e6:	85 c9                	test   %ecx,%ecx
 7e8:	74 0c                	je     7f6 <printint+0x66>
    buf[i++] = '-';
 7ea:	c6 44 1d d8 2d       	movb   $0x2d,-0x28(%ebp,%ebx,1)
    buf[i++] = digits[x % base];
 7ef:	89 d8                	mov    %ebx,%eax
    buf[i++] = '-';
 7f1:	ba 2d 00 00 00       	mov    $0x2d,%edx

  while(--i >= 0)
 7f6:	8b 7d b8             	mov    -0x48(%ebp),%edi
 7f9:	8d 5c 05 d7          	lea    -0x29(%ebp,%eax,1),%ebx
 7fd:	eb 07                	jmp    806 <printint+0x76>
 7ff:	90                   	nop
    putc(fd, buf[i]);
 800:	0f b6 13             	movzbl (%ebx),%edx
 803:	83 eb 01             	sub    $0x1,%ebx
  write(fd, &c, 1);
 806:	83 ec 04             	sub    $0x4,%esp
 809:	88 55 d7             	mov    %dl,-0x29(%ebp)
 80c:	6a 01                	push   $0x1
 80e:	56                   	push   %esi
 80f:	57                   	push   %edi
 810:	e8 ae fe ff ff       	call   6c3 <write>
  while(--i >= 0)
 815:	83 c4 10             	add    $0x10,%esp
 818:	39 de                	cmp    %ebx,%esi
 81a:	75 e4                	jne    800 <printint+0x70>
}
 81c:	8d 65 f4             	lea    -0xc(%ebp),%esp
 81f:	5b                   	pop    %ebx
 820:	5e                   	pop    %esi
 821:	5f                   	pop    %edi
 822:	5d                   	pop    %ebp
 823:	c3                   	ret    
 824:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  neg = 0;
 828:	c7 45 bc 00 00 00 00 	movl   $0x0,-0x44(%ebp)
 82f:	eb 87                	jmp    7b8 <printint+0x28>
 831:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 838:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 83f:	90                   	nop

00000840 <printf>:

// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
 840:	55                   	push   %ebp
 841:	89 e5                	mov    %esp,%ebp
 843:	57                   	push   %edi
 844:	56                   	push   %esi
 845:	53                   	push   %ebx
 846:	83 ec 2c             	sub    $0x2c,%esp
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
 849:	8b 5d 0c             	mov    0xc(%ebp),%ebx
{
 84c:	8b 75 08             	mov    0x8(%ebp),%esi
  for(i = 0; fmt[i]; i++){
 84f:	0f b6 13             	movzbl (%ebx),%edx
 852:	84 d2                	test   %dl,%dl
 854:	74 6a                	je     8c0 <printf+0x80>
  ap = (uint*)(void*)&fmt + 1;
 856:	8d 45 10             	lea    0x10(%ebp),%eax
 859:	83 c3 01             	add    $0x1,%ebx
  write(fd, &c, 1);
 85c:	8d 7d e7             	lea    -0x19(%ebp),%edi
  state = 0;
 85f:	31 c9                	xor    %ecx,%ecx
  ap = (uint*)(void*)&fmt + 1;
 861:	89 45 d0             	mov    %eax,-0x30(%ebp)
 864:	eb 36                	jmp    89c <printf+0x5c>
 866:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 86d:	8d 76 00             	lea    0x0(%esi),%esi
 870:	89 4d d4             	mov    %ecx,-0x2c(%ebp)
    c = fmt[i] & 0xff;
    if(state == 0){
      if(c == '%'){
        state = '%';
 873:	b9 25 00 00 00       	mov    $0x25,%ecx
      if(c == '%'){
 878:	83 f8 25             	cmp    $0x25,%eax
 87b:	74 15                	je     892 <printf+0x52>
  write(fd, &c, 1);
 87d:	83 ec 04             	sub    $0x4,%esp
 880:	88 55 e7             	mov    %dl,-0x19(%ebp)
 883:	6a 01                	push   $0x1
 885:	57                   	push   %edi
 886:	56                   	push   %esi
 887:	e8 37 fe ff ff       	call   6c3 <write>
 88c:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
      } else {
        putc(fd, c);
 88f:	83 c4 10             	add    $0x10,%esp
  for(i = 0; fmt[i]; i++){
 892:	0f b6 13             	movzbl (%ebx),%edx
 895:	83 c3 01             	add    $0x1,%ebx
 898:	84 d2                	test   %dl,%dl
 89a:	74 24                	je     8c0 <printf+0x80>
    c = fmt[i] & 0xff;
 89c:	0f b6 c2             	movzbl %dl,%eax
    if(state == 0){
 89f:	85 c9                	test   %ecx,%ecx
 8a1:	74 cd                	je     870 <printf+0x30>
      }
    } else if(state == '%'){
 8a3:	83 f9 25             	cmp    $0x25,%ecx
 8a6:	75 ea                	jne    892 <printf+0x52>
      if(c == 'd'){
 8a8:	83 f8 25             	cmp    $0x25,%eax
 8ab:	0f 84 07 01 00 00    	je     9b8 <printf+0x178>
 8b1:	83 e8 63             	sub    $0x63,%eax
 8b4:	83 f8 15             	cmp    $0x15,%eax
 8b7:	77 17                	ja     8d0 <printf+0x90>
 8b9:	ff 24 85 14 0d 00 00 	jmp    *0xd14(,%eax,4)
        putc(fd, c);
      }
      state = 0;
    }
  }
}
 8c0:	8d 65 f4             	lea    -0xc(%ebp),%esp
 8c3:	5b                   	pop    %ebx
 8c4:	5e                   	pop    %esi
 8c5:	5f                   	pop    %edi
 8c6:	5d                   	pop    %ebp
 8c7:	c3                   	ret    
 8c8:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 8cf:	90                   	nop
  write(fd, &c, 1);
 8d0:	83 ec 04             	sub    $0x4,%esp
 8d3:	88 55 d4             	mov    %dl,-0x2c(%ebp)
 8d6:	6a 01                	push   $0x1
 8d8:	57                   	push   %edi
 8d9:	56                   	push   %esi
 8da:	c6 45 e7 25          	movb   $0x25,-0x19(%ebp)
 8de:	e8 e0 fd ff ff       	call   6c3 <write>
        putc(fd, c);
 8e3:	0f b6 55 d4          	movzbl -0x2c(%ebp),%edx
  write(fd, &c, 1);
 8e7:	83 c4 0c             	add    $0xc,%esp
 8ea:	88 55 e7             	mov    %dl,-0x19(%ebp)
 8ed:	6a 01                	push   $0x1
 8ef:	57                   	push   %edi
 8f0:	56                   	push   %esi
 8f1:	e8 cd fd ff ff       	call   6c3 <write>
        putc(fd, c);
 8f6:	83 c4 10             	add    $0x10,%esp
      state = 0;
 8f9:	31 c9                	xor    %ecx,%ecx
 8fb:	eb 95                	jmp    892 <printf+0x52>
 8fd:	8d 76 00             	lea    0x0(%esi),%esi
        printint(fd, *ap, 16, 0);
 900:	83 ec 0c             	sub    $0xc,%esp
 903:	b9 10 00 00 00       	mov    $0x10,%ecx
 908:	6a 00                	push   $0x0
 90a:	8b 45 d0             	mov    -0x30(%ebp),%eax
 90d:	8b 10                	mov    (%eax),%edx
 90f:	89 f0                	mov    %esi,%eax
 911:	e8 7a fe ff ff       	call   790 <printint>
        ap++;
 916:	83 45 d0 04          	addl   $0x4,-0x30(%ebp)
 91a:	83 c4 10             	add    $0x10,%esp
      state = 0;
 91d:	31 c9                	xor    %ecx,%ecx
 91f:	e9 6e ff ff ff       	jmp    892 <printf+0x52>
 924:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
        s = (char*)*ap;
 928:	8b 45 d0             	mov    -0x30(%ebp),%eax
 92b:	8b 10                	mov    (%eax),%edx
        ap++;
 92d:	83 c0 04             	add    $0x4,%eax
 930:	89 45 d0             	mov    %eax,-0x30(%ebp)
        if(s == 0)
 933:	85 d2                	test   %edx,%edx
 935:	0f 84 8d 00 00 00    	je     9c8 <printf+0x188>
        while(*s != 0){
 93b:	0f b6 02             	movzbl (%edx),%eax
      state = 0;
 93e:	31 c9                	xor    %ecx,%ecx
        while(*s != 0){
 940:	84 c0                	test   %al,%al
 942:	0f 84 4a ff ff ff    	je     892 <printf+0x52>
 948:	89 5d d4             	mov    %ebx,-0x2c(%ebp)
 94b:	89 d3                	mov    %edx,%ebx
 94d:	8d 76 00             	lea    0x0(%esi),%esi
  write(fd, &c, 1);
 950:	83 ec 04             	sub    $0x4,%esp
          s++;
 953:	83 c3 01             	add    $0x1,%ebx
 956:	88 45 e7             	mov    %al,-0x19(%ebp)
  write(fd, &c, 1);
 959:	6a 01                	push   $0x1
 95b:	57                   	push   %edi
 95c:	56                   	push   %esi
 95d:	e8 61 fd ff ff       	call   6c3 <write>
        while(*s != 0){
 962:	0f b6 03             	movzbl (%ebx),%eax
 965:	83 c4 10             	add    $0x10,%esp
 968:	84 c0                	test   %al,%al
 96a:	75 e4                	jne    950 <printf+0x110>
      state = 0;
 96c:	8b 5d d4             	mov    -0x2c(%ebp),%ebx
 96f:	31 c9                	xor    %ecx,%ecx
 971:	e9 1c ff ff ff       	jmp    892 <printf+0x52>
 976:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 97d:	8d 76 00             	lea    0x0(%esi),%esi
        printint(fd, *ap, 10, 1);
 980:	83 ec 0c             	sub    $0xc,%esp
 983:	b9 0a 00 00 00       	mov    $0xa,%ecx
 988:	6a 01                	push   $0x1
 98a:	e9 7b ff ff ff       	jmp    90a <printf+0xca>
 98f:	90                   	nop
        putc(fd, *ap);
 990:	8b 45 d0             	mov    -0x30(%ebp),%eax
  write(fd, &c, 1);
 993:	83 ec 04             	sub    $0x4,%esp
        putc(fd, *ap);
 996:	8b 00                	mov    (%eax),%eax
  write(fd, &c, 1);
 998:	6a 01                	push   $0x1
 99a:	57                   	push   %edi
 99b:	56                   	push   %esi
        putc(fd, *ap);
 99c:	88 45 e7             	mov    %al,-0x19(%ebp)
  write(fd, &c, 1);
 99f:	e8 1f fd ff ff       	call   6c3 <write>
        ap++;
 9a4:	83 45 d0 04          	addl   $0x4,-0x30(%ebp)
 9a8:	83 c4 10             	add    $0x10,%esp
      state = 0;
 9ab:	31 c9                	xor    %ecx,%ecx
 9ad:	e9 e0 fe ff ff       	jmp    892 <printf+0x52>
 9b2:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
        putc(fd, c);
 9b8:	88 55 e7             	mov    %dl,-0x19(%ebp)
  write(fd, &c, 1);
 9bb:	83 ec 04             	sub    $0x4,%esp
 9be:	e9 2a ff ff ff       	jmp    8ed <printf+0xad>
 9c3:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
 9c7:	90                   	nop
          s = "(null)";
 9c8:	ba 0c 0d 00 00       	mov    $0xd0c,%edx
        while(*s != 0){
 9cd:	89 5d d4             	mov    %ebx,-0x2c(%ebp)
 9d0:	b8 28 00 00 00       	mov    $0x28,%eax
 9d5:	89 d3                	mov    %edx,%ebx
 9d7:	e9 74 ff ff ff       	jmp    950 <printf+0x110>
 9dc:	66 90                	xchg   %ax,%ax
 9de:	66 90                	xchg   %ax,%ax

000009e0 <free>:
static Header base;
static Header *freep;

void
free(void *ap)
{
 9e0:	55                   	push   %ebp
  Header *bp, *p;

  bp = (Header*)ap - 1;
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
 9e1:	a1 80 10 00 00       	mov    0x1080,%eax
{
 9e6:	89 e5                	mov    %esp,%ebp
 9e8:	57                   	push   %edi
 9e9:	56                   	push   %esi
 9ea:	53                   	push   %ebx
 9eb:	8b 5d 08             	mov    0x8(%ebp),%ebx
  bp = (Header*)ap - 1;
 9ee:	8d 4b f8             	lea    -0x8(%ebx),%ecx
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
 9f1:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 9f8:	89 c2                	mov    %eax,%edx
 9fa:	8b 00                	mov    (%eax),%eax
 9fc:	39 ca                	cmp    %ecx,%edx
 9fe:	73 30                	jae    a30 <free+0x50>
 a00:	39 c1                	cmp    %eax,%ecx
 a02:	72 04                	jb     a08 <free+0x28>
    if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
 a04:	39 c2                	cmp    %eax,%edx
 a06:	72 f0                	jb     9f8 <free+0x18>
      break;
  if(bp + bp->s.size == p->s.ptr){
 a08:	8b 73 fc             	mov    -0x4(%ebx),%esi
 a0b:	8d 3c f1             	lea    (%ecx,%esi,8),%edi
 a0e:	39 f8                	cmp    %edi,%eax
 a10:	74 30                	je     a42 <free+0x62>
    bp->s.size += p->s.ptr->s.size;
    bp->s.ptr = p->s.ptr->s.ptr;
 a12:	89 43 f8             	mov    %eax,-0x8(%ebx)
  } else
    bp->s.ptr = p->s.ptr;
  if(p + p->s.size == bp){
 a15:	8b 42 04             	mov    0x4(%edx),%eax
 a18:	8d 34 c2             	lea    (%edx,%eax,8),%esi
 a1b:	39 f1                	cmp    %esi,%ecx
 a1d:	74 3a                	je     a59 <free+0x79>
    p->s.size += bp->s.size;
    p->s.ptr = bp->s.ptr;
 a1f:	89 0a                	mov    %ecx,(%edx)
  } else
    p->s.ptr = bp;
  freep = p;
}
 a21:	5b                   	pop    %ebx
  freep = p;
 a22:	89 15 80 10 00 00    	mov    %edx,0x1080
}
 a28:	5e                   	pop    %esi
 a29:	5f                   	pop    %edi
 a2a:	5d                   	pop    %ebp
 a2b:	c3                   	ret    
 a2c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
 a30:	39 c2                	cmp    %eax,%edx
 a32:	72 c4                	jb     9f8 <free+0x18>
 a34:	39 c1                	cmp    %eax,%ecx
 a36:	73 c0                	jae    9f8 <free+0x18>
  if(bp + bp->s.size == p->s.ptr){
 a38:	8b 73 fc             	mov    -0x4(%ebx),%esi
 a3b:	8d 3c f1             	lea    (%ecx,%esi,8),%edi
 a3e:	39 f8                	cmp    %edi,%eax
 a40:	75 d0                	jne    a12 <free+0x32>
    bp->s.size += p->s.ptr->s.size;
 a42:	03 70 04             	add    0x4(%eax),%esi
 a45:	89 73 fc             	mov    %esi,-0x4(%ebx)
    bp->s.ptr = p->s.ptr->s.ptr;
 a48:	8b 02                	mov    (%edx),%eax
 a4a:	8b 00                	mov    (%eax),%eax
 a4c:	89 43 f8             	mov    %eax,-0x8(%ebx)
  if(p + p->s.size == bp){
 a4f:	8b 42 04             	mov    0x4(%edx),%eax
 a52:	8d 34 c2             	lea    (%edx,%eax,8),%esi
 a55:	39 f1                	cmp    %esi,%ecx
 a57:	75 c6                	jne    a1f <free+0x3f>
    p->s.size += bp->s.size;
 a59:	03 43 fc             	add    -0x4(%ebx),%eax
  freep = p;
 a5c:	89 15 80 10 00 00    	mov    %edx,0x1080
    p->s.size += bp->s.size;
 a62:	89 42 04             	mov    %eax,0x4(%edx)
    p->s.ptr = bp->s.ptr;
 a65:	8b 4b f8             	mov    -0x8(%ebx),%ecx
 a68:	89 0a                	mov    %ecx,(%edx)
}
 a6a:	5b                   	pop    %ebx
 a6b:	5e                   	pop    %esi
 a6c:	5f                   	pop    %edi
 a6d:	5d                   	pop    %ebp
 a6e:	c3                   	ret    
 a6f:	90                   	nop

00000a70 <malloc>:
  return freep;
}

void*
malloc(uint nbytes)
{
 a70:	55                   	push   %ebp
 a71:	89 e5                	mov    %esp,%ebp
 a73:	57                   	push   %edi
 a74:	56                   	push   %esi
 a75:	53                   	push   %ebx
 a76:	83 ec 1c             	sub    $0x1c,%esp
  Header *p, *prevp;
  uint nunits;

  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
 a79:	8b 45 08             	mov    0x8(%ebp),%eax
  if((prevp = freep) == 0){
 a7c:	8b 3d 80 10 00 00    	mov    0x1080,%edi
  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
 a82:	8d 70 07             	lea    0x7(%eax),%esi
 a85:	c1 ee 03             	shr    $0x3,%esi
 a88:	83 c6 01             	add    $0x1,%esi
  if((prevp = freep) == 0){
 a8b:	85 ff                	test   %edi,%edi
 a8d:	0f 84 9d 00 00 00    	je     b30 <malloc+0xc0>
    base.s.ptr = freep = prevp = &base;
    base.s.size = 0;
  }
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
 a93:	8b 17                	mov    (%edi),%edx
    if(p->s.size >= nunits){
 a95:	8b 4a 04             	mov    0x4(%edx),%ecx
 a98:	39 f1                	cmp    %esi,%ecx
 a9a:	73 6a                	jae    b06 <malloc+0x96>
 a9c:	bb 00 10 00 00       	mov    $0x1000,%ebx
 aa1:	39 de                	cmp    %ebx,%esi
 aa3:	0f 43 de             	cmovae %esi,%ebx
  p = sbrk(nu * sizeof(Header));
 aa6:	8d 04 dd 00 00 00 00 	lea    0x0(,%ebx,8),%eax
 aad:	89 45 e4             	mov    %eax,-0x1c(%ebp)
 ab0:	eb 17                	jmp    ac9 <malloc+0x59>
 ab2:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
 ab8:	8b 02                	mov    (%edx),%eax
    if(p->s.size >= nunits){
 aba:	8b 48 04             	mov    0x4(%eax),%ecx
 abd:	39 f1                	cmp    %esi,%ecx
 abf:	73 4f                	jae    b10 <malloc+0xa0>
        p->s.size = nunits;
      }
      freep = prevp;
      return (void*)(p + 1);
    }
    if(p == freep)
 ac1:	8b 3d 80 10 00 00    	mov    0x1080,%edi
 ac7:	89 c2                	mov    %eax,%edx
 ac9:	39 d7                	cmp    %edx,%edi
 acb:	75 eb                	jne    ab8 <malloc+0x48>
  p = sbrk(nu * sizeof(Header));
 acd:	83 ec 0c             	sub    $0xc,%esp
 ad0:	ff 75 e4             	push   -0x1c(%ebp)
 ad3:	e8 53 fc ff ff       	call   72b <sbrk>
  if(p == (char*)-1)
 ad8:	83 c4 10             	add    $0x10,%esp
 adb:	83 f8 ff             	cmp    $0xffffffff,%eax
 ade:	74 1c                	je     afc <malloc+0x8c>
  hp->s.size = nu;
 ae0:	89 58 04             	mov    %ebx,0x4(%eax)
  free((void*)(hp + 1));
 ae3:	83 ec 0c             	sub    $0xc,%esp
 ae6:	83 c0 08             	add    $0x8,%eax
 ae9:	50                   	push   %eax
 aea:	e8 f1 fe ff ff       	call   9e0 <free>
  return freep;
 aef:	8b 15 80 10 00 00    	mov    0x1080,%edx
      if((p = morecore(nunits)) == 0)
 af5:	83 c4 10             	add    $0x10,%esp
 af8:	85 d2                	test   %edx,%edx
 afa:	75 bc                	jne    ab8 <malloc+0x48>
        return 0;
  }
}
 afc:	8d 65 f4             	lea    -0xc(%ebp),%esp
        return 0;
 aff:	31 c0                	xor    %eax,%eax
}
 b01:	5b                   	pop    %ebx
 b02:	5e                   	pop    %esi
 b03:	5f                   	pop    %edi
 b04:	5d                   	pop    %ebp
 b05:	c3                   	ret    
    if(p->s.size >= nunits){
 b06:	89 d0                	mov    %edx,%eax
 b08:	89 fa                	mov    %edi,%edx
 b0a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
      if(p->s.size == nunits)
 b10:	39 ce                	cmp    %ecx,%esi
 b12:	74 4c                	je     b60 <malloc+0xf0>
        p->s.size -= nunits;
 b14:	29 f1                	sub    %esi,%ecx
 b16:	89 48 04             	mov    %ecx,0x4(%eax)
        p += p->s.size;
 b19:	8d 04 c8             	lea    (%eax,%ecx,8),%eax
        p->s.size = nunits;
 b1c:	89 70 04             	mov    %esi,0x4(%eax)
      freep = prevp;
 b1f:	89 15 80 10 00 00    	mov    %edx,0x1080
}
 b25:	8d 65 f4             	lea    -0xc(%ebp),%esp
      return (void*)(p + 1);
 b28:	83 c0 08             	add    $0x8,%eax
}
 b2b:	5b                   	pop    %ebx
 b2c:	5e                   	pop    %esi
 b2d:	5f                   	pop    %edi
 b2e:	5d                   	pop    %ebp
 b2f:	c3                   	ret    
    base.s.ptr = freep = prevp = &base;
 b30:	c7 05 80 10 00 00 84 	movl   $0x1084,0x1080
 b37:	10 00 00 
    base.s.size = 0;
 b3a:	bf 84 10 00 00       	mov    $0x1084,%edi
    base.s.ptr = freep = prevp = &base;
 b3f:	c7 05 84 10 00 00 84 	movl   $0x1084,0x1084
 b46:	10 00 00 
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
 b49:	89 fa                	mov    %edi,%edx
    base.s.size = 0;
 b4b:	c7 05 88 10 00 00 00 	movl   $0x0,0x1088
 b52:	00 00 00 
    if(p->s.size >= nunits){
 b55:	e9 42 ff ff ff       	jmp    a9c <malloc+0x2c>
 b5a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
        prevp->s.ptr = p->s.ptr;
 b60:	8b 08                	mov    (%eax),%ecx
 b62:	89 0a                	mov    %ecx,(%edx)
 b64:	eb b9                	jmp    b1f <malloc+0xaf>
